package com.jzo2o.customer.controller.worker;

import com.jzo2o.customer.enums.CertificationStatusEnum;
import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.service.BankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description BankAccountController
 * @Author luohai
 * @Date 2024-12-02
 */
@RestController("BankAccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "服务端 - 账户相关接口")
public class BankAccountController {

    @Autowired
    private BankAccountService bankAccountService;

    /**
     * 新增或更新银行账号信息接口
     * @param bankAccount
     */
    @PostMapping
    @ApiOperation("新增或更新银行账号信息接口")
    public void addOrUpdateBankAccount(@RequestBody BankAccount bankAccount){
        bankAccount.setType(CertificationStatusEnum.SUCCESS.getStatus());
        bankAccountService.addOrUpdateBankAccount(bankAccount);
    }

    /**
     * 获取当前用户银行账号接口
     * @return
     */
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号接口")
    public BankAccount getBankAccount(){
        return bankAccountService.getBankAccount();
    }
}
